package com.scvtc.controller.research;

import com.scvtc.domain.ResResult;
import com.scvtc.domain.dto.research.intellectual.ResearchIntellectualDto;
import com.scvtc.domain.vo.PageVo;
import com.scvtc.domain.vo.research.intellectual.ResearchIntellectualVo;
import com.scvtc.service.research.ResearchIntellectualService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 科研知识产权信息(ResearchIntellectual)表控制层
 *
 * @author yiFei
 * @since 2022-06-02 16:17:08
 */
@Api(tags = "科研知识产权信息(ResearchIntellectual)")
@RestController
@RequestMapping("researchIntellectual")
public class ResearchIntellectualController {
    /**
     * 科研知识产权信息(ResearchIntellectual)对象
     */
    @Autowired
    private ResearchIntellectualService researchIntellectualService;

    @GetMapping("/list")
    @ApiOperation("查询科研教材信息")
    public ResResult<PageVo<List<ResearchIntellectualVo>>> getAllResearchIntellectual(
            @RequestParam(defaultValue = "1") Long current,
            @RequestParam(defaultValue = "10") Long size,
            ResearchIntellectualVo researchIntellectualVo) {
        return researchIntellectualService.getAllResearchIntellectual(current, size, researchIntellectualVo);
    }

    @PostMapping("/")
    @ApiOperation("添加单个科研教材")
    public ResResult<?> addResearchIntellectual(@RequestBody ResearchIntellectualDto researchIntellectualDto) {
        return researchIntellectualService.addResearchIntellectual(researchIntellectualDto);
    }

    @PutMapping("/")
    @ApiOperation("修改单个科研教材")
    public ResResult<?> updateStudent(@RequestBody ResearchIntellectualDto researchIntellectualDto) {
        return researchIntellectualService.updateResearchIntellectual(researchIntellectualDto);
    }

    @DeleteMapping("/")
    @ApiOperation("删除一条科研教材信息")
    public ResResult<?> deleteResearchIntellectual(Long id) {
        return researchIntellectualService.deleteResearchIntellectual(id);
    }

    @DeleteMapping("/multiple")
    @ApiOperation("删除多条科研教材信息")
    public ResResult<?> deleteMultipleResearchIntellectual(Long[] ids) {
        return researchIntellectualService.deleteMultipleResearchIntellectual(ids);
    }
}

